package com.example.order.pojo;

public class Consumer {
    private String consumer_id;
    private String consumer_name;
    private String consumer_password;
    private String contact;
    private int reservation_result;
    private String old_password;

    public Consumer(String consumer_id, String consumer_name, String consumer_password, String contact, String reservation_result) {
        this.consumer_id = consumer_id;
        this.consumer_name = consumer_name;
        this.consumer_password = consumer_password;
        this.contact = contact;

        // 检查 reservation_result 是否为空
        if (reservation_result != null && !reservation_result.isEmpty()) {
            // 解析 reservation_result 为整数
            try {
                this.reservation_result = Integer.parseInt(reservation_result);
            } catch (NumberFormatException e) {
                // 处理解析异常，例如设置默认值
                this.reservation_result = 0;  // 默认值，你可以根据需求更改
                e.printStackTrace();
            }
        } else {
            // reservation_result 为空，设置默认值或保持为零，具体根据需求而定
            this.reservation_result = 0;  // 默认值，你可以根据需求更改
        }
    }

    // 无参数的构造函数
    public Consumer() {
        // 这里可以设置默认值或者保持为空，具体根据需求而定
    }

    // 生成 getter 和 setter 方法

    public String getConsumer_id() {
        return consumer_id;
    }

    public void setConsumer_id(String consumer_id) {
        this.consumer_id = consumer_id;
    }

    public String getConsumer_name() {
        return consumer_name;
    }

    public void setConsumer_name(String consumer_name) {
        this.consumer_name = consumer_name;
    }

    public String getConsumer_password() {
        return consumer_password;
    }

    public void setConsumer_password(String consumer_password) {
        this.consumer_password = consumer_password;
    }

    public String getContact() {
        return contact;
    }

    public void setContact(String contact) {
        this.contact = contact;
    }

    public int getReservation_result() {
        return reservation_result;
    }

    public void setReservation_result(int reservation_result) {
        this.reservation_result = reservation_result;
    }

    public String getOld_password() {
        return old_password;
    }

    public void setOld_password(String old_password) {
        this.old_password = old_password;
    }
}
